/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-08
 * Time: 11:18
 */
import java.util.*;
public class Main {
    public static void main(String[] args)  {
        List<Student> list=new ArrayList<Student>();
        list.add(new Student(10,"wangli",89,78,88));
        list.add(new Student(28,"Katefd",89,68,88));
        list.add(new Student(35,"Caoyue",69,78,86));
        list.add(new Student(36,"zhansa",69,78,83));
        list.add(new Student(47,"wanhua",98,88,88));
        list.add(new Student(52,"wanhai",69,88,89));
        list.add(new Student(63,"liwuab",89,78,88));
        Collections.sort(list);
        for(Student stu:list)
        {
            System.out.println(stu);
        }
    }
}
class Student implements Comparable<Student> {
    private int id;
    private String name;
    private int math;
    private int english;
    private int cs;

    //补充代码段1
    public Student(int id,String name,int math,int english,int cs) {
        // TODO Auto-generated constructor stub
        this.cs=cs;
        this.english=english;
        this.id=id;
        this.math=math;
        this.name=name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", math=" + math +
                ", english=" + english +
                ", cs=" + cs +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        // TODO Auto-generated method stub
        if (o.math>math) {
            return -1;
        }
        else if (o.math==math) {
            if (o.english>english) {
                return 1;
            }
            if (o.english==english) {
                if (o.cs>cs) {
                    return -1;
                }
                else if (o.cs==o.cs) {
                    return id-o.id;
                }
                else {
                    return 0;
                }
            }
            else {
                return -1;
            }
        }
        else {
            return 1;
        }
    }

    //补充代码段2
}
/* 请在这里填写完整的Student类的设计代码 */
